
<template>
    <div class="goods">
        <div class="good-header">
            商品
        </div>
        <div class="good-box">
            <router-link v-for="item in goodsList" :key="item.id" class="good-item" tag="li" :to="`/goodDetails/${item.id}`" >
                <div class="img_box">
                    <img :src="item.pic_url" :alt="item.goodsName" />
                </div>
                <div class="good-desc">
                    <div class="title">{{ item.name }}</div>
                    <div class="price">
                        {{ (item.price / 100).toFixed(2) }}
                    </div>
                </div>
            </router-link>
        </div>
    </div>
</template>
    
<script setup>
import { defineProps } from 'vue';
let props=defineProps({
    goodsList:{
        type:Array,
        default:[]
    }
})
</script>
    
<style  lang="scss" scoped>
.goods {
    width: 100%;
    background-color: rgb(243, 243, 243);
    .good-header {
        height: 1.33333rem;
        line-height: 1.33333rem;
        font-size: .42667rem;
        font-weight: 500;
        color: #0fc4b5;
        text-align: center
    }

    .good-box {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-content: space-between;

        .good-item {
            width: 49%;
            background: white;
            margin: 2px 0;
            box-sizing: border-box;

            .img_box {
                width: 90%;
                height: 188px;
                margin: 10px auto;
                overflow: hidden;

                img {
                    width: 100%;
                    height: auto;
                }
            }

            .good-desc {
                text-align: center;

                .title {
                    font-size: 0.378rem;
                    color: #222333;
                    -webkit-line-clamp: 2;
                    display: -webkit-box;
                    -webkit-box-orient: vertical;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    word-wrap: break-word;
                }

                .price {
                    font-size: 0.32rem;
                    color: #1baeae;
                    margin: 6px 0;
                }
            }
        }

    }
}
</style>